<template>
	<view>
		<view class="flex-col" style="height: calc(100vh - 100rpx)">
			<!-- 上部分  head-->
			<view>

			</view>

			<!-- 下部分 -->
			<view class="flex1 flex-col overhide" style="min-height: 0;">
				<mescroll-uni top='0' :fixed="false" @init="mescrollInit" @down="downCallback" @up="upCallback"
					:up="upOption" :down="downOption" bottom="0" :bottombar="false">
				</mescroll-uni>
			</view>
		</view>
	</view>
</template>

<script>
	import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
	export default {
		mixins: [MescrollMixin], // 使用mixin
		data() {
			return {
				downOption: {
					auto: true
				},
				upOption: {
					auto: false,
					page: {
						num: 0,
						size: 20,
					},
					textNoMore: '已经到底了'
				},
			}
		},
		computed: {
			lang() {
				return this.$store.state.lang
			},
		},
		onLoad() {},
		onShow() {
			this.$utils.changeFooterLang() //切换Tab栏的翻译
			uni.setNavigationBarTitle({
				title: this.$t('fan').粉丝管理
			})
		},


		methods: {
			upCallback(page) {
				if (page.num == 1) this.fsArr = []; //如果是第一页需手动制空列表
				this.$api.getfenlist({
					page: page.num,
					limit: page.size
				}).then(res => {
					let curPageData = res.data.list; //当前页的数据列表
					let curPageLen = curPageData.length; //当前页的数据长度
					let totalPage = parseInt(res.data.count / 20) + 1; //总页数
					let hasNext = page.num === totalPage ? false : true //根据页数判断是否有下一页
					this.fsArr = this.fsArr.concat(curPageData); //追加新数据
					this.mescroll.endSuccess(curPageLen, hasNext);
				})
			},
			//获取当前的年月和上月
			getnow() {
				const currentDate = new Date();
				const year = currentDate.getFullYear();
				const month = (currentDate.getMonth() + 1) < 10 ? `0${(currentDate.getMonth() + 1)}` : (currentDate
					.getMonth() + 1); // 月份从0开始，所以要加1
				this.thisMonth = year + '-' + month
				if (month == "01") {
					this.lastMonth = currentDate.getFullYear() - 1 + '-' + '12'
				} else {
					this.lastMonth = currentDate.getFullYear() + '-' + (currentDate.getMonth() < 10 ?
						`0${currentDate.getMonth()}` : currentDate.getMonth())
				}
			},
		},
	}
</script>

<style lang="scss">

</style>